package demo05;

public class person {
    private String name;
    private int age;

    public void show() {
        System.out.println("名字：" + name + " 年龄:" + age);
    }

    public void setAge(int num) {
        if (num > 0 && num < 100) {
            age = num;
        } else {
            System.out.println("数据不合理");
        }
    }

    public void setName(String name1) {
        name=name1;
    }

    public int getAge() {
        return age;
    }
}
